<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">

    <head>
        <title>Rich HTML email in Spring with Thymeleaf</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    </head>
    
    <body>
    
        <h1>Rich HTML email in Spring with Thymeleaf</h1>
        <p>
          This is a demo application exemplifying the use of Thymeleaf for creating
          and sending several kinds of HTML email in a Spring application.
        </p>
        <p>
          Note that, although for educational purposes this is a web application 
          developed with <b>Spring MVC</b> and <b>HTML5</b>, these same techniques would work perfectly in 
          a <b>standalone</b> application with no web interface at all.
        </p>
        
        
        <h2>HTML email (simple)</h2>
        
        <form action="sent.html" th:action="@{/sendMailSimple}" method="post">
 
          <fieldset>
           
            <label for="simpleRecipientName">To (name):</label>
            <input type="text" id="simpleRecipientName" name="recipientName" placeholder="John Smith" required="required" /> <br />
           
            <label for="simpleRecipientEmail">To (email):</label>
            <input type="email" id="simpleRecipientEmail" name="recipientEmail" placeholder="johnsmith@example.com" required="required" /> <br />
            
            <input type="submit" value="Send mail" />
            
          </fieldset>
           
        </form>
        
        
        
        <h2>HTML email with attachment</h2>
        
        <form action="sent.html" th:action="@{/sendMailWithAttachment}" method="post" enctype="multipart/form-data">
 
          <fieldset>

            <label for="attachRecipientName">To (name):</label>
            <input type="text" id="attachRecipientName" name="recipientName" placeholder="John Smith" required="required" /> <br />
           
            <label for="attachRecipientEmail">To (email):</label>
            <input type="email" id="attachRecipientEmail" name="recipientEmail" placeholder="johnsmith@example.com" required="required" /> <br />
            
            <label for="attachAttachment">Attachment (max 10Mb):</label>
            <input type="file" id="attachAttachment" name="attachment" required="required" /> <br />
            
            <input type="submit" value="Send mail" />
            
          </fieldset>
           
        </form>
        
        
        
        <h2>HTML email with inline image</h2>
        
        <form action="sent.html" th:action="@{/sendMailWithInlineImage}" method="post" enctype="multipart/form-data">
 
          <fieldset>

            <label for="inlineRecipientName">To (name):</label>
            <input type="text" id="inlineRecipientName" name="recipientName" placeholder="John Smith" required="required" /> <br />
           
            <label for="inlineRecipientEmail">To (email):</label>
            <input type="email" id="inlineRecipientEmail" name="recipientEmail" placeholder="johnsmith@example.com" required="required" /> <br />
            
            <label for="inlineImage">Inlined image (max 10Mb):</label>
            <input type="file" id="inlineImage" name="image" accept="image/*" required="required" /> <br />
            
            <input type="submit" value="Send mail" />
            
          </fieldset>
           
        </form>
        
    </body>
</html>
